﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.getcity" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Administration.Catalog;
using SIPO.Library.DomainObject.Administration.Catalog;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
namespace SIPO.Web.AjaxHandler.Loaddata
{
    public class getcity : SIPO.Web.BaseHandler
    {
        recCityRepo recCityDal = new recCityRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);

            int id = Convert.ToInt32(context.Request.Params["region_id"]);
            List<recCity> citys = recCityDal.GetList();
            var result = citys.Where(x => x.RegionID == id);

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}